function [checkStatus,failedVarsList] = analyse(tcPath,mode,sheetName,caseID)
% checkStatus (0|{1}) 
%							0 mismatch
%							1 match
checkStatus = 1;

% load expected result
expectedMat = [tcPath '\AutoGen\Expected\' sheetName '_' caseID '.mat'];
load(expectedMat);
vars = fieldnames(expected);

% load simulation result
resultMat = [tcPath '\AutoGen\TestResult\' mode '\' sheetName '_' caseID '.mat'];
load(resultMat);
logvars = fieldnames(result);
% load test case to get simtime
caseMat = [tcPath '\AutoGen\TestCase\' sheetName '_' caseID '.mat'];
load(caseMat);
nSimPoint = TC.simtime * 100;
clear TC;
failedVarsList = {''};
% create PreValue depends on logvars
% value = cell(length(vars),1);
for iVar = 1 : length(logvars)	
	varName = logvars{iVar,1};
	if isempty(expected.(varName))
        checkStatus = 0;
		continue;
    end
    timecomp=expected.(varName)(1,1);
	tmpExpected= handleExpect(expected.(varName),nSimPoint);
	if length(tmpExpected(:,2)) < nSimPoint
		nSimPoint = length(tmpExpected(:,2));
    end
    timecompare=timecomp*100+1;
	cmpResultValue = result.(varName)(timecompare:nSimPoint,1);
	cmpExpectedValue = cell2mat(tmpExpected(1:nSimPoint,2));
	Devitation = cell2mat(tmpExpected(timecompare:nSimPoint,3)); % MIL mode
	if strcmp(mode,'SIL')
		Devitation = cell2mat(tmpExpected(timecompare:nSimPoint,4)); % SIL mode
	end
	cmpResult = cmpResultValue - cmpExpectedValue ;
	if max(abs(cmpResult)) > abs(Devitation)
		if checkStatus 
			checkStatus = 0;
		end		
		failedVarsList(end+1,1) = {varName};
		continue;
	end
	% Check LSB
	LSB = cell2mat(tmpExpected(:,5));
	if strcmp(mode,'SIL') & mod(max(abs(cmpResult)),max(abs(LSB))) ~= 0 &	mod(max(abs(cmpResult)),max(abs(LSB*10))) == 0
		if checkStatus 
			checkStatus = 0;
		end
		if ~strmatch(varName,failedVarsList)
			failedVarsList(end+1,1) = {varName};
		end
		continue;
	end
end
failedVarsList(1) = '';